from Lib import UtilsGame
from Lib.Core.Scene import Scene
from Lib.Core.Game import UILayer
from Lib.Core.UISprite import UISprite
from constants import game, window_size


class SceneLogin(Scene):
    def __init__(self):
        super().__init__("SceneLogin")
        from Lib.Core.UIAutoText import UIAutoText
        text = u"测试文本测试文本测试文本测试文本测试文本\nasd服务而威尔额外\n......"

        from Lib.UtilsGame import Image
        background = Image("background11",window_size)
        game.ui_group.add(UISprite(background))

        auto_text = UIAutoText([0, 0, 1000, 300], UILayer.MID.value, text,
                               500, 18, [255, 255, 255], UtilsGame.Center([500, 100]))

        def _StopClick():
            UtilsGame.ClearLayerUI(UILayer.MID.value)
            from Lib.UtilsGame import SetScene
            SetScene("SceneMap")
            # ui = UIAutoText([0, 0, 1000, 300], UILayer.MID.value, text,
            #                 500, 18, [255, 0, 0], UtilsGame.Center([500, 100]))
            # ui.StopClick = _StopClick
            # game.ui_group.add(ui)

        auto_text.StopClick = _StopClick
        game.ui_group.add(auto_text)

        from Lib.UtilsGame import CutScreenBlack
        CutScreenBlack("in")
